Skip to content

Conversation

cfriedt
Copy link
Member

@cfriedt cfriedt commented Oct 8, 2025

Add SMBus Process Call API for STM32.

The Process Call API is very useful, as it sends a command (a 16-bit word split over two data bytes) to the target, and then waits for the target to return a result (similarly a 16-bit word) dependent on the command.

This implementation also supports PEC mode (packet error checking) and is dependent on PEC support already being supported in-tree.

For more details, please see Section 6.5.6 of the SMBus 3.1 Specification.
https://smbus.org/specs/SMBus_3_1_20180319.pdf

This change should only be merged after #96691

In the case that SMBus hardware does not automatically perform packet
error checking (PEC), provide generic inline functions in
`zephyr/drivers/smbus.h` that can be used by drivers to perform PEC in
software.

Signed-off-by: Chris Friedt <[email protected]>
Signed-off-by: Andrew Lewycky <[email protected]>
Add tests for SMBus packet error correction (PEC). The two primary
utilities tested are

* smbus_pec(): compute the PEC byte for a Block Write
* smbus_read_check_pec(): verify a PEC after
  * Read Byte
  * Read Word
  * Block Read

Signed-off-by: Chris Friedt <[email protected]>
Add support for SMBus packet error checking (PEC) to the stm32 driver.
This feature allows SMBust communication to be slightly more robust in
the presence of noise, in that packet errors can be detected on the
receive side.

Signed-off-by: Andrew Lewycky <[email protected]>
Signed-off-by: Chris Friedt <[email protected]>
Add SMBus Process Call API for STM32.

The Process Call API is very useful, as it sends a command (a 16-bit word
split over two data bytes) to the target, and then waits for the target to
return a result (similarly a 16-bit word) dependent on the command.

This implementation also supports PEC mode (packet error checking) and is
dependent on PEC support already being supported in-tree.

Signed-off-by: James Growden <[email protected]>
Signed-off-by: Chris Friedt <[email protected]>
@cfriedt cfriedt requested review from erwango and etienne-lms October 8, 2025 12:36
@erwango erwango requested a review from benediktibk October 8, 2025 12:38
Copy link

sonarqubecloud bot commented Oct 8, 2025

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit "drivers: smbus: stm32: add support for pcall api" LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants